package com.example.exp04_multithread_collision_balls_view;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.example.modelandview.BallView;

public class MainActivity extends AppCompatActivity {
    BallView ballView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //ballView是自定义的View
        ballView = new BallView(this);
        setContentView(ballView);
        //启动了小球的绘制
        ballView.startDrawing();
    }

    //为避免在程序退出后线程仍在进行,造成不必要的系统资源浪费,在Activity退出是时候,主动将线程停止
    @Override
    public void onDestroy()
    {
        ballView.stopDrawing();
        super.onDestroy();
    }
}